

import 'package:reabampos/src/reabam/operation/bean/bean_paytype.dart';
import 'package:reabampos/src/reabam/operation/db/objectbox.dart';
import 'package:reabampos/src/reabam/ui/pagestate_main_webview.dart';
import 'package:xsdk_flutter/xsdk/xsdk_flutter_package.dart';

/*
支付兜底
 */
class SupportRepayOrder {

  MainWebViewStatePage statePage;
  SupportRepayOrder(this.statePage);

///////////////////////////////////////////////////////////////////////////

  void createOrderPayRequest(dynamic data){

    BeanH5OfflinePay requestPromotion;
    if(data is String){
      requestPromotion=BeanH5OfflinePay.fromJson(XJsonUtils.json2Map(data));
    }else{
      requestPromotion=BeanH5OfflinePay.fromJson(data);
    }

    XObjectBoxUtils.CreateOrderPayRequest(requestPromotion,(Map<String,dynamic> result){
      String json=XJsonUtils.obj2Json(result);
      statePage.runJSFunction(statePage.jsFunction_getAppValue('CreateOrderPayRequest',json));
    });
  }
  void updateOrderPayRequest(dynamic data){

    BeanH5OfflinePay requestPromotion;
    if(data is String){
      requestPromotion=BeanH5OfflinePay.fromJson(XJsonUtils.json2Map(data));
    }else{
      requestPromotion=BeanH5OfflinePay.fromJson(data);
    }

    XObjectBoxUtils.UpdateOrderPayRequest(requestPromotion,(Map<String,dynamic> result){
      String json=XJsonUtils.obj2Json(result);
      statePage.runJSFunction(statePage.jsFunction_getAppValue('UpdateOrderPayRequest',json));
    });
  }
  void getOrderPayRequest(dynamic data){

    String fastOrderNo='$data';
    XObjectBoxUtils.getOrderPayRequest(fastOrderNo,(Map<String,dynamic> result){
      String json=XJsonUtils.obj2Json(result);
      statePage.runJSFunction(statePage.jsFunction_getAppValue('GetOrderPayRequest',json));
    });
  }


}